myDbconfig={
    //  "host"     : "127.0.0.1",
    //         "user"     : "root",
    //         "password" : "123456",
    //         "port"     : "3306",
       
     "database" : "miapi"
}
Db=M.getMySql(myDbconfig);
Db.doSql(`select 1`).then(d=>console.log(d))

s={}
// s["/index.html"]=async (req,res)=>{
//     await  res.renderUrl("https://6d69-minglie-31e331-1302367385.tcb.qcloud.la/dh/select.html")
// }

app.begin(async (req, res) => {
    console.log("req ", req.url)
    var pathname = url_module.parse(req.url).pathname;
    console.log("pathname",pathname)
    if (Object.keys(s).indexOf(pathname)>-1) {
       await  s[pathname](req,res)
    }
})





app.post("/doSql",async function (req,res) {
    try{      
        var rows= await Db.doSql(req.params.sql);
        res.send(M.result(rows));
      
    }catch (e){
        res.send(M.result(e,false));
    }
})